#include <bits/stdc++.h>

using namespace std;

int a[1000001];
bool b[1000001];
int n, zuo;
int minu = INT_MAX;

int main()
{
    memset(b,1,sizeof(b));
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    std::ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        int x;
        cin >> x;
        a[i] = x;
    }
    sort(a + 1 , a + n + 1);
    int num = a[1];
    for(int i = 1; i <= n; i++)
    {
        if(minu > a[i] && a[i] != num)
        {
            minu = a[i];
            zuo = i;
        }
    }
    int st = 1;
    for(int i = zuo; i <= n; i++)
    {
        for(int j = st; j < i; j++)
        {

            if(b[i] == 1 && a[i] > a[j])
            {
                st++;
                b[i] = 0;
                a[j] = -1;
                break;
            }
        }
    }
    int ans = 0;
    for(int i = 1; i <= n; i++)
    {
        if(a[i] != -1) ans++;
    }
    cout << ans << endl;
    return 0;
}
